package com.ttn.common.core.util;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class OrderNumGeneratorUtil {
    public static String generatorOrderNum(int num) {
        // 获取当前日期时间
        LocalDateTime currentDateTime = LocalDateTime.now();

        // 使用自定义的日期时间格式化器，格式化为订单号
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
        String orderNumber = currentDateTime.format(formatter) + String.format("%04d", num);
        return "OD" + orderNumber;

    }

}
